package com.dingding.dao.usermangerdao.impl;

import java.util.List;

import com.dingding.bean.databean.response.ResGetUserBalanceList;
import com.dingding.bean.databean.response.ResGetUserDepositList;
import com.dingding.bean.entity.Depositdetail;
import com.dingding.bean.entity.Useraccountdetail;
import com.dingding.common.core.util.ToolUtil;
import com.dingding.dao.basedao.impl.BaseDaoImpl;
import com.dingding.dao.usermangerdao.IUserAccountDetailDao;

public class UserAccountDetailDaoImpl extends BaseDaoImpl<Useraccountdetail> implements IUserAccountDetailDao {

	/**
	 * @Title: setResGetUserBalanceList
	 * @Description: 设置返回bean的属性
	 * @param list
	 *            数据库查询到的list
	 * @param resList
	 *            响应的bean的list
	 * @author zhaochenguang
	 * @return void
	 * @throws
	 */

	public void setResGetUserBalanceList(List<Useraccountdetail> list,
			List<ResGetUserBalanceList> resList) {

		for (Useraccountdetail useraccountdetail : list) {
			ResGetUserBalanceList temp = new ResGetUserBalanceList();
			// 设置交易金额
			if(useraccountdetail.getTradeMoney() != null){
				temp.setTradeMoney(useraccountdetail.getTradeMoney());
			}
			// 设置时间
			if(useraccountdetail.getTradeTime() != null){
				temp.setTradeTime(useraccountdetail.getTradeTime());
			}
			// 设置交易类型
			if(useraccountdetail.getTradeType() != null){
				temp.setTradeType(useraccountdetail.getTradeType());
			}
			// 设置用户账户交易明细ID
			if(ToolUtil.isNotBlank(useraccountdetail.getUadId())){
				temp.setUadId(useraccountdetail.getUadId());
			}
			//设置实际支付金额
			if(useraccountdetail.getActualPaymentMoney() != null){
				temp.setActualPaymentMoney(useraccountdetail.getActualPaymentMoney());
			}
			//设置优惠金额
			if(useraccountdetail.getCouponMoney() != null){
				temp.setCouponMoney(useraccountdetail.getCouponMoney());
			}
			
			resList.add(temp);
		}
	}
	
	/**
	 * @Title: setResGetUserDepositList 
	 * @Description: 转换bean list，获取提现详情
	 * @param list
	 * @param resList 
	 * @author lijinchao
	 * @return void
	 * @throws
	 */
	public void setResGetUserDepositList(List<Depositdetail> list,
			List<ResGetUserDepositList> resList){
		for (Depositdetail depositdetail : list) {
			ResGetUserDepositList temp = new ResGetUserDepositList();
			// 设置提现金额
			if(depositdetail.getDepositMoney() != null){
				temp.setDepositMoney(depositdetail.getDepositMoney());
			}
			// 设置支付宝账号
			if(ToolUtil.isNotBlank(depositdetail.getZfbAccount())){
				temp.setZfbAccount(depositdetail.getZfbAccount());
			}
			// 设置提现时间
			if(depositdetail.getDepositTime() != null){
				temp.setDepositTime(depositdetail.getDepositTime());
			}
			//提现状态
			if(depositdetail.getDepositStatus() != null){
				temp.setDepositStatus(depositdetail.getDepositStatus());
			}
			
			resList.add(temp);
		}
	}
}
